<template>
    <el-drawer
        title="团购详情"
        ref="elDrawer"
        :destroy-on-close="true"
        size="85%"
        :visible.sync="drawerVisible"
        direction="rtl">
        <template v-if="type === 'newCar'">
            <new-car-group-detail :id="groupId" :groupBrandList="groupBrandList" :readonly="true" />
        </template>
        <template v-else-if="type === 'afterSell'">
            <after-sell-group-detail :id="groupId" :readonly="true" />
        </template>
    </el-drawer>
</template>
<script>
    import newCarGroupDetail from '../newCar-group/group-detail'
    import afterSellGroupDetail from '../afterSell-group/group-detail'
    export default({
        props: {
            type: String,
            options: {
                type: Object,
                default: () => ({
                    visible: false,
                    groupId: 0
                })
            },
            groupBrandList: Array
        },
        components: { newCarGroupDetail, afterSellGroupDetail },
        data() {
            return {
                drawerVisible: false,
                groupId: 0
            }
        },
        watch: {
            options: function(val) {
                const { visible, groupId } = val
                if (visible) {
                    this.drawerVisible = visible
                    this.groupId = groupId
                }
            }
        },
        methods: {
        },
        created() {
        }
    })
</script>